#pragma once

#include "ClockEngine.h"
#include "Jerry's Physics\Physic_World.h"

#define V3DFToV3(v) Vector3(v.x,v.y,v.z)
#define V3ToV3DF(v) V3DF(v.x,v.y,v.z)

class gObject : public clkMesh
{
protected:
	Physic_World*  m_world;
	Physic_Object* m_phyObj;
public:
	gObject();
	~gObject();

	void init(
		WINAPP*       a_app,
		WINFPS*       a_fps,
		WINTIME*      a_time,
		D3DF*         a_d3d,
		DINF*         a_din,
		Physic_World* a_world);

	virtual void initPhysics();
	virtual void initPhysics(Physic_Object* a_phyObj);
	virtual void update();

	V3DF getPos(){return V3ToV3DF(m_phyObj->getPosition());}
	V3DF getVel(){return V3ToV3DF(m_phyObj->getVelocity());}
	float getRad(){return m_phyObj->getRadius();}

	void setPos(V3DF a_pos){m_phyObj->setPosition(a_pos.x,a_pos.y,a_pos.z);};
	void setVel(V3DF a_vel){m_phyObj->setVelocity(a_vel.x,a_vel.y,a_vel.z);};

	Physic_Object* getPhysics(){return m_phyObj;}
};